package com.translate.web.api.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.param.impl.IdPageParam;
import com.translate.vo.TeamSigningRewardsVO;
import com.response.vo.ResponseModel;
import com.controller.base.AbstractCommonController;
import com.translate.web.param.TeamSigningRewardsUpdateParam;
import com.translate.entity.TeamSigningRewards;
import com.translate.web.service.ITeamSigningRewardsService;
import com.basic.service.contract.IBaseService;

@RestController
@RequestMapping("teamSigningRewards")
public class TeamSigningRewardsController extends AbstractCommonController<TeamSigningRewards, IdPageParam> {
	private ITeamSigningRewardsService service;

	public TeamSigningRewardsController(ITeamSigningRewardsService service) {
		this.service = service;
	}

	@Override
	protected IBaseService<TeamSigningRewards> getBaseService() {
		return this.service;
	}

	/**
	 * 服务介绍列表
	 * @param param
	 * @return
	 */
	@GetMapping("/listServices")
	public ResponseModel<List<TeamSigningRewardsVO>> listServices() {
		
		return ResponseModel.<List<TeamSigningRewardsVO>>success(
				this.service.getListFromCache(TeamSigningRewardsVO.class));
	}
	
	/**
	 * 添加
	 * 
	 * @param <V>
	 * @param param
	 * @return
	 */
	@PostMapping("/update")
	public ResponseModel<Integer> update(@Validated @RequestBody TeamSigningRewardsUpdateParam param,
			HttpServletRequest httpServletRequest) {
		int res = this.service.parseUpdate(param, TeamSigningRewards.class);
		return ResponseModel.<Integer>success(res);
	}

	protected <VO> Class<VO> getTarget() {
		return (Class<VO>) TeamSigningRewardsVO.class;
	}
}